#!/usr/bin/env python3
import argparse
import os
import sys
import pandas as pd


def main(args):
    if args.ligand_pdb and os.path.exists(args.ligand_pdb):
        try:
            path_ = os.path.dirname(f"{args.ligand_pdb}")
            os.system(f'/Pub/Users/wangyk/software/molecular_dockinig/p2rank_2.5/prank predict -f {args.ligand_pdb} -o {path_}')
            
        except Exception as e:
            print(f"警告: 读取文件失败: {e}", file=sys.stderr)


if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="计算对接分子中心坐标.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter
    )
    parser.add_argument("ligand_pdb", help="配体PDB文件路径")

    try:
        args = parser.parse_args()
        main(args)

    except Exception as e:
        print(f"错误: {str(e)}", file=sys.stderr)
        sys.exit(1)
